package main

import "fmt"

func swap1(p *int) {
	*p = 100
}

func changeVal(p int) {
	p = 10
}

func point() {
	var a int = 1
	changeVal(a)
	fmt.Println("a =", a)

	var b int = 1
	swap1(&b)
	fmt.Println("b =", b)
}

func swap(a *int, b *int) {
	fmt.Println(*a, *b)
	var temp int

	temp = *a

	fmt.Println(temp)
	*a = *b
	*b = temp

}

func main() {
	//指针
	point()
	fmt.Println("-------------------")
	//数据交换
	var a int = 100
	var b int = 200
	swap(&a, &b)
	fmt.Println(a, b)
}
